package com.example.fms.exception;

import com.example.fms.vo.Meta;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;


public class BusinessException extends RuntimeException {
    @Getter
    private int code;

    @Getter
    private String msgKey;

    @Getter
    private Object errorData;

    @Getter
    private Meta meta;


    public BusinessException(ExceptionEnum exceptionEnum,Meta meta) {
        this.code = exceptionEnum.getCode();
        this.msgKey = exceptionEnum.getMsgKey();
        this. meta = meta;
    }

    public BusinessException(ExceptionEnum exceptionEnum) {
        this.code = exceptionEnum.getCode();
        this.msgKey = exceptionEnum.getMsgKey();
        this. meta = exceptionEnum.getMeta();

    }

    public BusinessException(String msgKey) {
        this.msgKey = getMsgKey();
    }
}
